package com.trhui.mallbook.client;

import com.trhui.mallbook.domain.common.ApiRequest;
import com.trhui.mallbook.domain.common.BaseResponse;
import com.trhui.mallbook.domain.request.DownloadCheckRequest;
import com.trhui.mallbook.domain.request.hf.HfImageUploadRequest;
import com.trhui.mallbook.domain.request.hf.HfSubMerSubmitRequest;
import com.trhui.mallbook.domain.request.hf.HfUploadFileSubMerRequest;
import com.trhui.mallbook.domain.request.xib.XibImageUploadRequest;
import com.trhui.mallbook.domain.request.yb.YbImageUploadRequest;
import com.trhui.mallbook.domain.response.DownloadCheckResponse;
import com.trhui.mallbook.domain.response.FileUploadResponse;
import com.trhui.mallbook.domain.response.hf.HfSubMerSubmitResponse;
import com.trhui.mallbook.domain.response.hf.HfUploadFileSubMerResponse;
import com.trhui.mallbook.enums.ChannelTypeEnum;
import com.trhui.mallbook.enums.ServerCodeEnum;


/**
 * @author huangh
 * @version 1.0
 * @description 对账单下载接口
 * @date 2023/08/17 0017 15:41
 */

public class FileClient extends AbstractClient {

    /**
     * MallBook-对账单下载
     *
     * @param request
     * @return
     */
    public static BaseResponse<DownloadCheckResponse> billDownload(DownloadCheckRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.DOWNLOAD_CHECK)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(reqApiRequest, DownloadCheckResponse.class);
    }


    /**
     * 汇付文件上传接口
     *
     * @param request
     * @return
     */
    public static BaseResponse<FileUploadResponse> hfFileUpload(HfImageUploadRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.FILE_UPLOAD)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(reqApiRequest, FileUploadResponse.class);
    }

    /**
     * 易宝文件上传接口
     *
     * @param request
     * @return
     */
    public static BaseResponse<FileUploadResponse> ybFileUpload(YbImageUploadRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.FILE_UPLOAD)
                .channelType(ChannelTypeEnum.YB)
                .build();
        return post(reqApiRequest, FileUploadResponse.class);
    }

    /**
     * 厦门国际银行文件上传接口
     *
     * @param request
     * @return
     */
    public static BaseResponse<FileUploadResponse> xibFileUpload(XibImageUploadRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.FILE_UPLOAD)
                .channelType(ChannelTypeEnum.XIB)
                .build();
        return post(reqApiRequest, FileUploadResponse.class);
    }

    /**
     * 收款子商户文件上传接口（HF）
     *
     * @param request
     * @return
     */
    public static BaseResponse<HfUploadFileSubMerResponse> hfUploadFileSubMer(HfUploadFileSubMerRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.UPLOAD_FILE_SUB_MER)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(reqApiRequest, HfUploadFileSubMerResponse.class);
    }

    /**
     * 收款子商户提交证照接口（HF）
     *
     * @param request
     * @return
     */
    public static BaseResponse<HfSubMerSubmitResponse> hfSubMerSubmit(HfSubMerSubmitRequest request) {
        ApiRequest reqApiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.SUB_MER_SUBMIT)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(reqApiRequest, HfSubMerSubmitResponse.class);
    }
}
